package com.shop.cereshop.agent;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@SpringBootApplication
@EnableTransactionManagement
@EnableConfigurationProperties
@EnableAspectJAutoProxy(exposeProxy = true)
@EnableAutoConfiguration(exclude = {
    org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
})
@EnableAsync
@EnableScheduling
@ComponentScan(value = { "com.shop.cereshop.agent", "com.shop.cereshop.commons" })
@MapperScan("com.shop.cereshop.agent.dao")
public class CereshopSalespersonAgentApplication extends SpringBootServletInitializer {

  /**
   * 需要把web项目打成war包部署到外部tomcat运行时需要改变启动方式
   */
  @Override // 重写configure方法，把springboot的入口给它
  protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
    return builder.sources(CereshopSalespersonAgentApplication.class);
  }

  public static void main(String[] args) {
    SpringApplication.run(CereshopSalespersonAgentApplication.class, args);
    System.out.println("------  salespersonAgent -server启动成功    ------\n");
  }
}